
<template>
    <div>
        <div class="search content-box">
            <h6 class="title-h6">产品查询</h6>
            <el-form :inline="true" :model="searchFrom" class="demo-form-inline" label-position="right" label-width="150px" style="padding-top:20px;text-align:left;padding-left:50px;">
                <el-form-item label="软件包名称">
                    <el-input v-model="searchFrom.name" placeholder="请输入软件包名称"></el-input>
                </el-form-item>
                <el-form-item label="投放状态">
                    <el-select v-model="searchFrom.status" placeholder="请选择投放状态">
                    <el-option label="上线" value="1"></el-option>
                    <el-option label="下线" value="0"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" >查询</el-button>
                </el-form-item>
                </el-form>
        </div>
        <div class="content-box">
            <h6 class="title-h6">产品列表</h6>
            <el-table
                :data="tableData"
                style="width: 100%;text-align:center">
                <el-table-column
                label="产品编号"
                width="180">
                <template slot-scope="scope">
                    <span style="margin-left: 10px">{{ scope.row.procode }}</span>
                </template>
                </el-table-column>
                <el-table-column
                label="软件包名"
                width="180" prop="name">
                </el-table-column>
                <el-table-column
                label="地址"
                width="180" prop="address">
                </el-table-column>
                <el-table-column
                label="软件包渠道号"
                width="180" prop="waynumber">
                </el-table-column>
                <el-table-column
                label="投放状态"
                width="180" prop="status">
                </el-table-column>
                <el-table-column
                label="添加时间"
                width="180" prop="time">
                </el-table-column>    
                <el-table-column label="操作">
                <template slot-scope="scope">
                    <el-button
                    size="mini" @click="handleEdit(scope.$index, scope.row)"
                    >编辑</el-button>
                    <router-link :to="{name: 'prolinkdetail', params: { proId: 1 }}">查看</router-link>
                    <el-button
                    size="mini"
                    type="danger"
                    >删除</el-button>
                </template>
                </el-table-column>
            </el-table>
        </div> 
    </div>
</template>

<script>
import {mapActions} from 'vuex'
export default {
    name: 'LocalpackList',
    data() {
        return {
          searchFrom: {
              name:'',
              status: ''
          },
          tableData: [
            {
              procode: 'P2018031501',
              name: '爱奇艺',
              address: '本地包',
              waynumber: '渠道001',
              status: 1,
              time: '2018-02-02 12:22:22',

            },
            {
              procode: 'P2018031501',
              name: '爱奇艺',
              address: '本地包',
              waynumber: '渠道001',
              status: 0,
              time: '2018-02-02 12:22:22',

            }
          ]
        }
    },
    methods: {
        ...mapActions([
            'setProLink',
            'setAddProLink', 
            'setEditorFlag'
        ]),
        handleEdit(index, row) {
           this.setEditorFlag(true);
           let addproLink = {
             putChannel: '本地包',
             packNumber: '',
             downloadLink: '',
             packName: '',
             parameter: '',
             remark: '',
             website: [], // 本地包
             softId: '' // 本地包
          }
          this.setAddProLink(addproLink)
          this.$router.push({name: 'prolink', params: { proId: 3 }})

        }
    }
}
</script>

<style>

</style>

